@extends('admin.layout')
@section('title',$title)
@section('content')
<div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
               文章管理
                <small>文章管理</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                <li><a href="#">文章管理</a></li>
                <li class="active">文章管理</li>
            </ol>
        </section>
         @if(count($errors)>0)
                            <div class="alert alert-danger alert-dismissable">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&time;</button>
                            <h4><i class="icon fa fa-ban"></i>警告！</h4>
                            <ol>
                                @foreach($errors->all()as $error)
                                <li>{{$error}}</li>
                                @endforeach

                            </ol>
                            </div>
                            @endif
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">文章添加</h3>
                        </div><!-- /.box-header -->
                        <!-- form start -->
                       

                        <form role="form" action="/admin/article/{{$data ->id}}"method="post" enctype="multipart/form-data">
                        {{ csrf_field() }}
                        {{method_field('put')}}
                        <input type = "hidden" name = "oldImg" value="{{$data ->img}}"></input>
                            <div class="box-body">
                                <div class="form-group">
                                    <label for="exampleInputEmail1">文章名</label>
                                    <input type="text" value="{{$data ->title}}" name = "title"  class="form-control" id="exampleInputEmail1"
                                           placeholder="请输入文章名">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">作者</label>
                                    <input type="text" value="{{$data ->title}}" name = "author"  class="form-control" id="exampleInputEmail1"
                                           placeholder="请输入作者">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">原文章缩略图</label>
                                    <img src="{{$data ->img}}"  width = "200px">
                                    
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">文章缩略图</label>
                                    <input type="file"  name = "img"  />
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">文章内容</label>
                                    <script type="text/javascript" charset="utf-8" src="{{asset('/ue/ueditor.config.js')}}"></script>
                                     <script type="text/javascript" charset="utf-8" src="{{asset('/ue/ueditor.all.min.js')}}"> </script>
                                     <script id="editor" type="text/plain" name="content" style="width:100%;height:500px;">{!! $data ->content !!}</script>
                                </div>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
                                    <script type="text/javascript"  charset="utf-8" src="{{asset('/ue/lang/zh-cn/zh-cn.js')}}"></script>
                                    <script type="text/javascript">
                                    //实例化编辑器
                                    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
                                    var ue = UE.getEditor('editor');
                                    </script>
                               </div>
                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">提交</button>
                                <button type="reset" class="btn btn-danger">重置</button>
                            </div>
                            
                        </form>
                    </div><!-- /.box -->               
                        </div><!-- /.box-body -->
                    </div><!-- /.box -->
                </div><!--/.col (right) -->
            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
    @endsection